package com.sk.bilibili.other;

import androidx.annotation.NonNull;

import com.bumptech.glide.annotation.GlideExtension;
import com.bumptech.glide.annotation.GlideOption;
import com.bumptech.glide.request.BaseRequestOptions;
import com.sk.bilibili.R;

// 主要用于 图片的默认值
@GlideExtension//标注为扩展类
public class GlideExtend {

    //构造方法必须私有
    private GlideExtend() { }

    @NonNull
    @GlideOption
    public static BaseRequestOptions<?> bg(BaseRequestOptions<?> options) {
        return options.placeholder(R.drawable.bg).error(R.drawable.bg);
    }

    @NonNull
    @GlideOption
    public static BaseRequestOptions<?> code(BaseRequestOptions<?> options) {
        return options.placeholder(R.drawable.code).error(R.drawable.code);
    }

    @NonNull
    @GlideOption
    public static BaseRequestOptions<?> header(BaseRequestOptions<?> options) {
        return options.circleCrop().placeholder(R.drawable.default_header).error(R.drawable.default_header);
    }

    @NonNull
    @GlideOption
    public static BaseRequestOptions<?> img(BaseRequestOptions<?> options) {
        return options.placeholder(R.drawable.default_img).error(R.drawable.default_img);
    }

    @NonNull
    @GlideOption
    public static BaseRequestOptions<?> flash(BaseRequestOptions<?> options) {
        return options.placeholder(R.drawable.flash).error(R.drawable.flash);
    }

    @NonNull
    @GlideOption
    public static BaseRequestOptions<?> vImg(BaseRequestOptions<?> options) {
        return options.placeholder(R.drawable.vi).error(R.drawable.vi);
    }

    @NonNull
    @GlideOption
    public static BaseRequestOptions<?> rect(BaseRequestOptions<?> options) {
        return options.placeholder(R.drawable.rect).error(R.drawable.rect);
    }

    @NonNull
    @GlideOption
    public static BaseRequestOptions<?> year(BaseRequestOptions<?> options) {
        return options.placeholder(R.drawable.channel_year).circleCrop().error(R.drawable.channel_year);
    }

    @NonNull
    @GlideOption
    public static BaseRequestOptions<?> type(BaseRequestOptions<?> options) {
        return options.placeholder(R.drawable.type).circleCrop().error(R.drawable.type);
    }

}